﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using MetroWashroom.ViewModels;

namespace MetroWashroom
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            InitLineName();
        }

        private void InitLineName()
        {
            List<MetroLine> listMertoLines = new List<MetroLine>()
            {
                new MetroLine(){LineName="一号线",LineStartToEnd="一号线(广州东站-西朗)", LineNum=1},
                new MetroLine(){LineName="二号线",LineStartToEnd="二号线(嘉禾望岗-广州南站)",LineNum=2},
                new MetroLine(){LineName="三号线及其北延线",LineStartToEnd="三号线(天河客运站--番禺广场)及其北延线(机场南--体育西路)",LineNum=3},
                new MetroLine(){LineName="四号线",LineStartToEnd="四号线(黄村--金洲)",LineNum=4},
                new MetroLine(){LineName="五号线",LineStartToEnd="五号线(滘口--文冲)",LineNum=5},
                //new MetroLine(){LineName="六号线",LineNum=6},
                //new MetroLine(){LineName="七号线",LineNum=7},
                new MetroLine(){LineName="八号线",LineStartToEnd="八号线(凤凰新村--万胜围)",LineNum=8},
                new MetroLine(){LineName="广佛线",LineStartToEnd="广佛线(西朗--魁奇路)",LineNum=9},
                new MetroLine(){LineName="APM线",LineStartToEnd="APM线(林和西--赤岗塔)",LineNum=10}
            };
            myListBox.DataContext = listMertoLines;
        }

        private void myListBox_Tap(object sender, GestureEventArgs e)
        {
            MetroLine selectedItem = myListBox.SelectedItem as MetroLine;
            string lineName = selectedItem.LineName;
            int lineNum = selectedItem.LineNum;
            NavigationService.Navigate(new Uri("/LineStation.xaml?lineName=" + lineName + "&lineNum=" + lineNum, UriKind.Relative));
        }

        private void appBarheple_Click(object sender, EventArgs e)
        {
            NavigationService.Navigate(new Uri("/Help.xaml", UriKind.Relative));
        }

        private void appBarSeach_Click(object sender, EventArgs e)
        {
            NavigationService.Navigate(new Uri("/Seach.xaml", UriKind.Relative));
        }
    }
}